//
//  SearchViewController.m
//  OfferJob
//
//  Created by 河南动力无限科技有限公司 on 17/7/19.
//  Copyright © 2017年 郑州动力无限科技. All rights reserved.
//

#import "SearchViewController.h"

@interface SearchViewController ()<UITextFieldDelegate>
@property(nonatomic,strong)SearchBlock blockOne;
@end

@implementation SearchViewController
-(id)initWithBlock:(SearchBlock)block{
    self=[super init];
    if (self) {
        _blockOne=block;
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self newSearch];
}
-(void)newSearch{

 
    UIImageView *SearchBG=[[UIImageView alloc]initWithFrame:CGRectMake(80*kAppScale,10*kAppScale, 200*kAppScale,30*kAppScale)];
    SearchBG.layer.borderColor = [[UIColor whiteColor] CGColor];
    SearchBG.layer.borderWidth = 0.5;
    SearchBG.layer.cornerRadius = 3;
    SearchBG.backgroundColor=whiteLineColore;
    SearchBG.userInteractionEnabled=YES;
    self.navigationItem.titleView=SearchBG;
    UIImageView *IconImage=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SearchBG.height, SearchBG.height)];
    IconImage.image=[UIImage imageNamed:@"search"];
    [SearchBG addSubview:IconImage];
    UITextField *searchText=[[UITextField alloc]initWithFrame:CGRectMake(IconImage.right+10*kAppScale, 0, SearchBG.width-SearchBG.height-5*kAppScale , 35*kAppScale)];
    searchText.font=[UIFont systemFontOfSize:13*kAppScale];
    searchText.placeholder=@"输入关键字搜索";
    [searchText setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
    searchText.tag=666;
    searchText.clearButtonMode=UITextFieldViewModeWhileEditing;
    searchText.returnKeyType=UIReturnKeySearch;
    searchText.textColor=blackTextColor;
    searchText.delegate=self;
    [SearchBG addSubview:searchText];

    
    UIButton *  sousuoBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [sousuoBtn setAdjustsImageWhenHighlighted:NO];
    sousuoBtn.frame = CGRectMake(0, 0, 80, 44);
    sousuoBtn.titleLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:16.0f];
    [sousuoBtn setTitle:@"搜索" forState:UIControlStateNormal];
    [sousuoBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
    [sousuoBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [sousuoBtn addTarget:self action:@selector(sousuoBtn) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarItem=[[UIBarButtonItem alloc] initWithCustomView:sousuoBtn];
    self.navigationItem.rightBarButtonItem = rightBarItem;
  
    
}
- (void)sousuoBtn{



}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
